package com.xinlu.user.action;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.xinlu.common.log.Logger;
import com.xinlu.derek.common.BaseAction;
import com.xinlu.derek.common.BaseForm;
import com.xinlu.persistence.Users;
import com.xinlu.user.bo.ZxczBo;
import com.xinlu.user.form.ZxczForm;

public class ZxczAction extends BaseAction {

	protected static Logger logger = Logger.getLogger(ZxczAction.class);
	
	private ZxczForm fr = new ZxczForm();
	
	/********	Bo注入Start	***********/
	private ZxczBo zxczBo;
	
	public void setZxczBo(ZxczBo zxczBo) {
		this.zxczBo = zxczBo;
	}
	/********	Bo注入End	***********/

	@Override
	public String doExecute() throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void formInit() {
		// TODO Auto-generated method stub
		
	}
	
	public String userZxcz() throws IOException{
		
		HttpServletRequest request = ServletActionContext.getRequest();
		HttpServletResponse response = ServletActionContext.getResponse();
		HttpSession session = request.getSession();
		
		
		Users myself =  (Users) session.getAttribute("userinfo");
		
		Users users = this.zxczBo.userZxcz(myself.getUsername(), fr.getJiner(), fr.getBz(), fr.getCzfs(), fr.getAccount());
				
		session.setAttribute("userinfo", users);
			
		response.getWriter().write("0");
		
		
		return null;
	}

	@Override
	public BaseForm getModel() {
		
		return fr;
	}

}
